package com.cgy.bionimec.repository;

import com.cgy.bionimec.entity.Binghuan;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import javax.transaction.Transactional;

public interface BinghuanRespository extends JpaRepository<Binghuan, String>, JpaSpecificationExecutor<Binghuan> {

    /***
     * 查询总条数
     */
    @Query(value = "select count (*) from Binghuan ")
    Long findCoount();

    /**
     * 删除信息
     */
    @Query(value = "DELETE FROM Binghuan WHERE id=?1",nativeQuery = true)
    @Modifying
    @Transactional
    Integer deleteBinghuan(Integer id);

    /**
     * 根据id查询信息
     */
    @Query(value = "select * FROM Binghuan",nativeQuery = true)
    Binghuan findBinghuanById(Integer id);



}
